feat(pi,omp): add runtime model fallback - #2358
Conversation
Entire-Checkpoint: 7e7a1e43230b
|
Warning Indent Zero is shutting down on August 7th. Please migrate over to Indent 2.0 to continue getting PR reviews.
|
|
Warning Review limit reached
Next review available in: 10 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds shared runtime fallback policy logic and integrates it with Pi and OMP. The change adds configurable retry rules, model cooldowns, fallback switching, continuation turns, Home Manager installation, template generation, and validation tests. ChangesRuntime fallback
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Provider
participant RuntimeFallback
participant FallbackPolicy
participant PiOrOMP
Provider->>RuntimeFallback: provider response
RuntimeFallback->>FallbackPolicy: classify status or error
FallbackPolicy-->>RuntimeFallback: fallback decision
RuntimeFallback->>PiOrOMP: select fallback model
PiOrOMP-->>RuntimeFallback: model selection result
RuntimeFallback->>PiOrOMP: dispatch continuation turn
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@config/shared/fallback/runtime-fallback.ts`:
- Around line 232-246: Update the fallback handling around
selectRef(decision.to) so a failed selection marks that candidate unavailable
and continues attempting the next eligible fallback model instead of returning
immediately. Reuse the existing fallback-selection flow, and notify/report
exhaustion only after all eligible candidates fail to select; preserve the
commit and continue-message behavior once a candidate is successfully selected.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: df576f49-8363-49fb-942c-02411d630c46
📒 Files selected for processing (11)
config/omp/default.nixconfig/omp/fallback.jsonconfig/omp/fallback.tpl.jsonconfig/omp/fallback.tsconfig/pi/default.nixconfig/pi/fallback.jsonconfig/pi/fallback.tpl.jsonconfig/pi/fallback.tsconfig/shared/fallback/runtime-fallback.tsscripts/llm-update.shspec/llm_update_spec.sh
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…odels Entire-Checkpoint: f09646b18b10
…ec block Entire-Checkpoint: 916a934c741d
Entire-Checkpoint: 532bf810626b
Entire-Checkpoint: 6b95ab79e8cb
Entire-Checkpoint: c88fab3612ed
Entire-Checkpoint: 30a66d0885de
Adds a fallback chain on Pi, and turns on OMP's native one. OpenCode is unchanged.
Each host gets the mechanism it actually has
Investigation changed the shape of this PR twice, so the current split is:
retry.fallbackChainsinconfig/omp/config.ymlcooldown-expiryrevert, thinking-level preservation, integrated with turn recovery. Strictly better than anything an extension can do.opencode-runtime-fallback@0.2.3config/pi/fallback.tsretryonly retries the same model, and it has no chain support. This is the one host that needs code.Since Pi is the only consumer, the policy lives in that one self-contained file rather than a shared module — an earlier revision of this PR had a
config/shared/fallback/extracted for Pi + OMP, which the OMP finding made pointless.Pi extension
Reads
~/.pi/agent/fallback.json(same schema asopencode-fallback.jsoncminustimeout_seconds, which an extension cannot honor on Pi). On a turn ending in a retryable error it cools the failed model down, selects the next eligible model in the chain, and re-triggers the turn.agent_end.model_selectand OMP does not, so this diffsctx.modelinstead of relying on an event only one host has.Chains
cliproxyapi/glm-4.7cliproxyapi/deepseek-v4-flashOMP's
defaultchain is expanded to every model role without its own chain, so role turns fall back too.Testing
shellspec spec/llm_update_spec.sh— 86 examples, 0 failures.omp config get retry.fallbackChainsreturns the configured chain andretry.fallbackRevertPolicyreturnscooldown-expiry.HOME: 429 → minimax, 503 → gemini-flash, 400 ignored; unregistered candidates skipped to the next; manual switch toclaude-opus-5survives a clean turn with no restore;{"fallback_models": "..."}yields[]and no-ops.nix fmt,nix flake check,biome checkclean.